using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using THSERP.BusinessEntities;
using THSERP.BaseProvider;
namespace THSERP.Modules.POS
{
    public class BRPOSRedemptionItemsGridControl : THSGridControl
    {
        public override void InitGridControlDataSource()
        {
            //base.InitGridControlDataSource();
            POSEntities entity = (POSEntities)((BaseModuleERP)Screen.Module).CurrentModuleEntity;
            BindingSource bds = new BindingSource();
            bds.DataSource = entity.BRPOSRedemptionItemsList;
            this.DataSource = bds;
        }
        protected override DevExpress.XtraGrid.Views.Grid.GridView InitializeGridView()
        {
            
            DevExpress.XtraGrid.Views.Grid.GridView gridView = base.InitializeGridView();
            DevExpress.XtraGrid.Columns.GridColumn colQty = gridView.Columns["BRPOSRedemptionItemProductQty"];
            if (colQty != null)
            {
                colQty.SummaryItem.FieldName = "BRPOSRedemptionItemProductQty";
                colQty.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
                colQty.SummaryItem.DisplayFormat = "{0:n2}";
            }
            //
            DevExpress.XtraGrid.Columns.GridColumn colTotalCost = gridView.Columns["BRPOSRedemptionItemTotalAmount"];
            if (colTotalCost != null)
            {
                colTotalCost.SummaryItem.FieldName = "BRPOSRedemptionItemTotalAmount";
                colTotalCost.SummaryItem.SummaryType = DevExpress.Data.SummaryItemType.Sum;
                colTotalCost.SummaryItem.DisplayFormat = "{0:n2}";
               
            }
            gridView.OptionsView.ShowFooter = true;
            return gridView;
        }
    }

}
